﻿@model Tasks.UI.Models.HotelEditModel
@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>酒店编辑</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.combobox.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $().ready(function () {
            $("#form").validate({
                showErrors: function (errorMap, errorList) {
                    $.Msg.errorTips("您的表单填写不完整:", 0, errorList);
                },
                rules: {
                    Name: "required"
                },
                messages: {
                    Name: "请输入酒店名称"
                },
                /* 获得焦点时不验证 */
                focusInvalid: false,
                onkeyup: false
            });

        })


        $(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");
            var breakFastName = $("input[name=BreakFastName]");
            var SupplyBreakfast = $("input[name=SupplyBreakfast]");
            breakFastName.each(function (m) {
                setIsbreakFast($(this), SupplyBreakfast.get(m));
            });
        });

        /*是否含早*/
        function setIsbreakFast(jobj, tagObject) {
            var jsondata = [
            ["0", "不含"],
             ["1", "含"]
            ];
            jobj.combobox({
                TagObject: tagObject,
                MustMatching: true,
                ListWidth: 250,
                DisplayHead: true,
                ListType: ListType.Combobox,
                DataType: DataType.Json,
                DataSource: jsondata,
                DataLoadOnce: false,
                TextFormat: 'V1',
                ValueFormat: 'V0',
                HeadColumn: [
            { name: "编号", width: 60, display: true },
            { name: "名称" }
            ],
                KeyWordColumn: ''
            });

        }

        function addRow(tbl) {
            var tr = $("#" + tbl + " tbody tr").eq(0).clone();

            $(".roomName", tr).val("");
            $(".weekendPrice", tr).val("0");
            $(".unWeekendPrice", tr).val("0");
            $(".weekendPriceCost", tr).val("0");
            $(".unWeekendPriceCost", tr).val("0");
            $(".marketPrice", tr).val("0");
            tr.show();
            tr.appendTo("#" + tbl);
            var txtBreFast = $("input[name=BreakFastName]", tr);
            var valBreFast = $("input[name=SupplyBreakfast]", tr);
            setIsbreakFast(txtBreFast, valBreFast.get(0));
        }
        function delRow(src) {
            $.Msg.confirmDelete(function () {
                var row = $(src).parent().parent();
                row.remove();
            });
        }
        function goaction(act) {
            $("#act").val(act);
            $("form").submit();
        }
      
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <input id="act" name="act" type="hidden" />
        <div id="container">
            <div class="navTitle">
                编辑酒店信息
            </div>
            @Html.OutputMessage(Model.Message, Model.MessageType)
            <div id="horizontal" class="pageBody">
                <table style="width: 100%;" border="0">
                    <tr>
                        <td style="width: 95px;">
                            <strong>酒店名称：</strong>
                        </td>
                        <td style="width: 350px;">@Html.TextBoxFor(t => t.Name, new { style = "width:300px;" })
                        </td>
                        <td style="width: 120px;">
                            <strong>付款方式：</strong>
                        </td>
                        <td>
                            @Html.DropDownList("PaymentMode", PageHelper.EnterprisePaymentModeSelector(Model.PaymentMode))
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>星&nbsp;&nbsp;&nbsp; 级：</strong>
                        </td>
                        <td>
                            @Html.DropDownList("Level", PageHelper.HotelLevelSelector(Model.Level))
                        </td>
                        <td style="width: 80px;">
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>地&nbsp;&nbsp;&nbsp; 区：</strong>
                        </td>
                        <td>
                            @Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                            @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                            @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>地&nbsp;&nbsp;&nbsp; 址：</strong>
                        </td>
                        <td colspan="3">
                            @Html.TextBoxFor(t => t.Address, new { style = "width:300px;" })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>开业时间：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.OpenDate)
                        </td>
                        <td>
                            <strong>联系人：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Linkman)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>前台电话：</strong>
                        </td>
                        <td>@Html.TextBoxFor(t => t.ReceiveTel)
                        </td>
                        <td>
                            <strong>联系电话：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.LinkTel)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>前台传真：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.ReceiveFax)
                        </td>
                        <td>
                            <strong>传真：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Fax)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>房间数量：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.RoomCount)
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>酒店网址：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.WebSiteUrl)
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <strong>备注：</strong>
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Remark)
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
                <div class="navTitle">
                    房间价格信息
                </div>
                <table id="tb1" class="tblMultiColumnStyle" style="table-layout: fixed; width: 900px;">
                    <thead>
                        <tr>
                            <th style="width: 150px;" rowspan="2">
                                房间名
                            </th>
                            <th colspan="2">
                                同行销售价
                            </th>
                            <th colspan="2">
                                地接成本
                            </th>
                            <th style="width: 120px;" rowspan="2">
                                挂牌价
                            </th>
                            <th style="width: 120px;" rowspan="2">
                                是否含早
                            </th>
                            <th style="width: 120px;" rowspan="2">
                                操作
                            </th>
                        </tr>
                        <tr>
                            <th style="width: 120px;">
                                周末价格
                            </th>
                            <th style="width: 120px;">
                                非周末价格
                            </th>
                            <th style="width: 120px;">
                                周末价格
                            </th>
                            <th style="width: 120px;">
                                非周末价格
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (HotelRoom room in Model.HotelRooms)
                        {
                            <tr>
                                <td>
                                    <input name="RoomName" type="text" value="@room.RoomName" class="roomName"/>
                                </td>
                                <td>
                                    <input name="WeekendPrice" type="text" value="@room.WeekendPrice" size="5" class="weekendPrice r"/>
                                </td>
                                <td>
                                    <input name="UnWeekendPrice" type="text" value="@room.UnWeekendPrice" size="5"  class="unWeekendPrice r"/>
                                </td>
                                <td>
                                    <input name="WeekendPriceCost" type="text" value="@room.WeekendPriceCost" size="5" class="weekendPriceCost r"/>
                                </td>
                                <td>
                                    <input name="UnWeekendPriceCost" type="text" value="@room.UnWeekendPriceCost" size="5" class="unWeekendPriceCost r"/>
                                </td>
                                <td>
                                    <input name="MarketPrice" type="text" value="@room.MarketPrice" size="5"  class="marketPrice r"/>
                                </td>
                                <td>
                                    <input type="hidden" name="SupplyBreakfast" value="@room.SupplyBreakfast"/>
                                    <input name="BreakFastName" class="c" type="text" size="2" value="@(room.SupplyBreakfast == 1 ? "含" : "不含")"/>
                                </td>
                                <td>
                                    <img src="/Images/icon/16x16/add.png" onclick="javascript:addRow('tb1')" />
                                    <img src="/Images/icon/16x16/delete.png" onclick="delRow(this)" />
                                </td>
                            </tr>  }
                    </tbody>
                </table>
            </div>
            <div class="pageFooter">
                <a href="javascript:goaction('save')" class="button big blue"><span>保存</span></a>
                <a href="javascript:goaction('apply')" class="button big blue"><span>应用</span></a>
                <a href="javascript:closeTab()" class="button big blue"><span>关闭</span></a>
            </div>
        </div>
    }
</body>
</html>
